/* 
 * File:   oustream.h
 * Author: minaev
 *
 * Created on 18 Декабрь 2013 г., 15:19
 */

#ifndef OUSTREAM_H
#define	OUSTREAM_H
#include <istream>
#include <ostream>
#include <streambuf>
#include <bits/codecvt.h>
#include <bits/basic_file.h>

#include <unistd.h>

//Berkeley sockets
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <arpa/inet.h>
#include <netdb.h>

#define LENBUF 15

using namespace std;

class oustream : public streambuf {
protected:
    char* buf;
    struct sockaddr_in sa;
    struct sockaddr_in saoutUDP;
    int udpSocket;
    
    streamsize xsputn(const char* __s, uint16_t __n);
    int_type overflow(int_type __c);
    
public:
    oustream(in_addr_t ipaddr_src, uint16_t prt);
    ~oustream();

};

#endif	/* OUSTREAM_H */

